using JavaVirtualMachine.ConstantPoolItems;
using System;

namespace JavaVirtualMachine.Attributes
{
    public class RuntimeInvisibleAnnotationsAttribute: AttributeInfo
    {
        public ushort NumAnnotations;
        public Annotation[] Annotations;

        public RuntimeInvisibleAnnotationsAttribute(ref ReadOnlySpan<byte> data, CPInfo[] constants) : base(ref data, constants)
        {
            ReadOnlySpan<byte> infoAsSpan = info.AsSpan();
            NumAnnotations = infoAsSpan.ReadTwo();
            Annotations = new Annotation[NumAnnotations];
            for (int i = 0; i < NumAnnotations; i++)
            {
                Annotations[i] = new Annotation(ref infoAsSpan, constants);
            }
        }
    }
}